<template>
  <div class="super-admin">
    <div class="header">
      <h1 class="title">超级管理员</h1>
      <p class="subtitle">管理系统用户、课程和权限</p>
    </div>

    <div class="tabs">
      <button 
        v-for="tab in tabs" 
        :key="tab.key"
        :class="['tab-button', { active: activeTab === tab.key }]"
        @click="activeTab = tab.key"
      >
        <i :class="tab.icon"></i>
        {{ tab.label }}
      </button>
    </div>

    <div class="tab-content">
      <!-- 教师管理 -->
      <div v-if="activeTab === 'teachers'" class="tab-panel">
        <TeacherManagement />
      </div>

      <!-- 学生管理 -->
      <div v-if="activeTab === 'students'" class="tab-panel">
        <StudentManagement />
      </div>

      <!-- 课程管理 -->
      <div v-if="activeTab === 'courses'" class="tab-panel">
        <CourseManagement />
      </div>

      <!-- 课程分配 -->
      <div v-if="activeTab === 'assignments'" class="tab-panel">
        <CourseAssignment />
      </div>

      <!-- 权限管理 -->
      <div v-if="activeTab === 'permissions'" class="tab-panel">
        <PermissionManagement />
      </div>
    </div>
  </div>
</template>

<script>
import { ref } from 'vue'
import TeacherManagement from './components/TeacherManagement.vue'
import StudentManagement from './components/StudentManagement.vue'
import CourseManagement from './components/CourseManagement.vue'
import CourseAssignment from './components/CourseAssignment.vue'
import PermissionManagement from './components/PermissionManagement.vue'

export default {
  name: 'SuperAdmin',
  components: {
    TeacherManagement,
    StudentManagement,
    CourseManagement,
    CourseAssignment,
    PermissionManagement
  },
  setup() {
    const activeTab = ref('teachers')

    const tabs = [
      {
        key: 'teachers',
        label: '教师管理',
        icon: 'fas fa-chalkboard-teacher'
      },
      {
        key: 'students',
        label: '学生管理',
        icon: 'fas fa-user-graduate'
      },
      {
        key: 'courses',
        label: '课程管理',
        icon: 'fas fa-book'
      },
      {
        key: 'assignments',
        label: '课程分配',
        icon: 'fas fa-users-cog'
      },
      {
        key: 'permissions',
        label: '权限管理',
        icon: 'fas fa-shield-alt'
      }
    ]

    return {
      activeTab,
      tabs
    }
  }
}
</script>

<style scoped>
.super-admin {
  padding: 24px;
  background: #f5f5f5;
  min-height: 100vh;
}

.header {
  margin-bottom: 32px;
}

.title {
  font-size: 28px;
  font-weight: 600;
  color: #1f2937;
  margin: 0 0 8px 0;
}

.subtitle {
  font-size: 16px;
  color: #6b7280;
  margin: 0;
}

.tabs {
  display: flex;
  background: white;
  border-radius: 8px;
  padding: 4px;
  margin-bottom: 24px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  overflow-x: auto;
}

.tab-button {
  flex: 1;
  min-width: 120px;
  padding: 12px 16px;
  border: none;
  background: transparent;
  color: #6b7280;
  font-size: 14px;
  font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.tab-button:hover {
  background: #f3f4f6;
  color: #374151;
}

.tab-button.active {
  background: #3b82f6;
  color: white;
  box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
}

.tab-button i {
  font-size: 16px;
}

.tab-content {
  background: white;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.tab-panel {
  padding: 24px;
}

@media (max-width: 768px) {
  .super-admin {
    padding: 16px;
  }
  
  .tabs {
    flex-direction: column;
  }
  
  .tab-button {
    justify-content: flex-start;
  }
  
  .tab-panel {
    padding: 16px;
  }
}
</style>